import GUniverse from "./GUniverse";

export default class Gobj{

    static GManager   = 0 
    static GPlayer    = 1;    
    static GEnemy     = 2;
    static GTower     = 3;
    static GBullet    = 4;

    pid = 0;//playerid;
    id = 0;//唯一id
    uid = 0;//宇宙id
    type = 0;//类型

    st = 0;//出生时间
    ct = 0;//时间now

    x = 0;//位置
    y = 0;//位置
    z = 0;//位置

    speed = 0;//速度
    hp = 0;//hp        
    count = 0;//计数器

    v0 = 0;//其它变量0
    v1 = 0;//其它变量1
    v2 = 0;//其它变量2

    get key():string{
        return this.pid+"_"+this.type+ "_"+this.id;
    }

    syncTime(other:Gobj){
        this.pid = other.pid;        
        this.st = other.st;
        this.ct = other.ct;

        this.x  = other.x;
        this.y  = other.y;
        this.z  = other.z;

        this.speed = other.speed;
        this.hp = other.hp;
        this.count = other.count;

        this.v0  = other.v0;
        this.v1  = other.v1;
        this.v2  = other.v2;        
    }

    copy():Gobj{
        var o = new Gobj();
        o.syncTime(this);
        o.id = this.id;
        return o;
    }

    timeline(sf:number , lf:number , fms:number , keyf:boolean , u:GUniverse,ac:any){}
}